# -*- coding: utf-8 -*-
# @File     : colors.py
# @Author   : bingjia
# @Time     : 2020/4/13 18:48
# @Desc     : 颜色

import random
from django.conf import settings

DEFAULT_PREDEFINED_COLORS = (
    "#fce94f",
    "#edd400",
    "#c4a000",
    "#8ae234",
    "#73d216",
    "#4e9a06",
    "#d3d7cf",
    "#fcaf3e",
    "#f57900",
    "#ce5c00",
    "#729fcf",
    "#3465a4",
    "#204a87",
    "#888a85",
    "#ad7fa8",
    "#75507b",
    "#5c3566",
    "#ef2929",
    "#cc0000",
    "#a40000"
)


PREDEFINED_COLORS = getattr(settings, "PREDEFINED_COLORS", DEFAULT_PREDEFINED_COLORS)


def generate_random_hex_color():
    return "#{:06x}".format(random.randint(0, 0xFFFFFF))


def generate_random_predefined_hex_color():
    return random.choice(PREDEFINED_COLORS)


ROLE_COLOR = {
    "前端": "#1bc5a3",
    "后端": "#4B0082",
    "飞手": "#1a3a95",
    "其他": generate_random_hex_color()
}
